19. CODE: Adding a Start and End to the Board
Adding a Start and End to the Board
Excellent work! Your project is essentially complete, and the A* search algorithm is fully functional. To wrap things up, there is one modification that can be made to the project to make the printout slightly clearer. At this point, your program should print the following:
🚗 ⛰️ 0 0 0 0
🚗 ⛰️ 0 0 0 0
🚗 ⛰️ 0 0 0 0
🚗 ⛰️ 0 🚗 🚗 🚗
🚗 🚗 🚗 🚗 ⛰️ 🚗
This is fantastic, but it isn't clear where the beginning and end of the path are. In this exercise, you will add a 🚦
for the beginning of the path, and a 🏁
for the end.
To Complete This Exercise:
- Add a kStart and kFinish to the
State
enum. - Set the grid cell to kStart for the initial coordinates and kFinish for the goal coordinates. This will happen in the
Search
function. - In
CellString
, add cases to return"🚦 "
for kStart and"🏁 "
for kFinish.
Workspace
This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity, so you may be able to download them there.
Workspace Information:
- Default file path:
- Workspace type: generic
- Opened files (when workspace is loaded): n/a
-
userCode:
export CXX=g++-7
export CXXFLAGS=-std=c++17
g++() {
/usr/bin/g++-7 -std=c++17 "$1"
}
export -f g++